package main

import (
	"time"

	"github.com/anotherGoogleFan/log"
	"github.com/gogap/logrus_mate"
	"github.com/sirupsen/logrus"

	_ "github.com/gogap/logrus_mate/writers/rotatelogs"
)

func main() {
	loadLogrusConfigFromConf("release")
	logrusLogger := logrus.StandardLogger()
	// log.SetOutput(logrusLogger.Out)
	log.SetLogrusLogger(logrusLogger)
	// log.SetLogrusFormatter(logrusLogger.Formatter)
	for {
		log.Fields{
			"test": "just a test",
		}.Info("tttteeeesssstttt")
		time.Sleep(time.Minute)
	}
}

func loadLogrusConfigFromConf(mode string) {
	mate, err := logrus_mate.NewLogrusMate(logrus_mate.ConfigFile("./logrus.conf"))
	if err != nil {
		panic(err)
	}

	if err := mate.Hijack(logrus.StandardLogger(), mode); err != nil {
		panic(err)
	}
	logrus.Info("LogParam Read Suc")
}
